<?php
namespace php\widgets\editor;
use yii\helpers\Html;
class WebLayoutWidget extends \yii\base\Widget{
	public $value;
	public $child;
	public $that;
    public $parent_type;

	public function run(){
		if(empty($this->value['value'])) return null;

		LayoutAsset::register($this->view);
		
		$shtml = Html::beginTag('div', [
			'class'=>'WebLayoutWidget '.(isset($this->value['value']['class']) ? $this->value['value']['class'] : ''),
			'style'=>(isset($this->value['value']['style']) ? $this->value['value']['style'] : ''),
			'id'=>(isset($this->value['value']['class_id']) ? $this->value['value']['class_id'] : ''),
		]);
		$shtml .= '<div class="row">';
		foreach ($this->value['value'] as $key => $val) {

			$shtml .= '<div class="col-xs-'.$val['col'].'">';

			if(!empty($this->value['childs'][$key])){
				foreach ($this->value['childs'][$key] as $k => $v) {
					$shtml .= $this->that->renderWidget($v);
				}
			}
			$shtml .= '</div>';
		}
		$shtml .= '</div>';
		$shtml .= Html::endTag('div');
		return $shtml;
	}
}